import {Component} from "react";

export default class Component1 extends Component{
  state = {
    uName:"nihao",
  }
  handleClick(prop){
    console.log(prop);
    // console.log(this.state.uName);
  }
  render() {
      return (
        <>
          <div>
            <button onClick={() =>this.handleClick(this.state.uName)}>按钮</button>
          </div>
        </>
      )
  }
}
/* 
值的获取；
  1. 变量定义在state中调用；
  2. 函数传值；

*/